package fy.erp.operator;

import com.seeyon.v3x.services.flow.bean.FlowExport;
import com.seeyon.v3x.services.form.bean.ValueExport;

import fy.erp.dao.LingLiaoDao;
import fy.form.listen.operate.AForm_Save_Operator;
import fy.form.listen.set.IFormSetting;

public class LingLiaoFormOperatorImpl extends AForm_Save_Operator {

	private static final String FORMNAME = "领料发料单";

	private String erpNumber;

	@Override
	public void operate(long summaryID, long userID) throws Exception {
		if (IFormSetting.CANCEL_STATUS != this.flowStatus) {
			super.operate(summaryID, userID);
		} else {
			erpNumber = LingLiaoDao.queryERPNumber(summaryID);
			super.success = save();
		}
	}

	public String getFormName() {
		return FORMNAME;
	}

	public void setFlowStatus(short flowStatus) {
		this.flowStatus = flowStatus;
	}

	@Override
	protected void parseOtherField_FirstStep(FlowExport flowExport) {

	}

	@Override
	protected void parseValueExport(ValueExport ve) {
		if ("ERP单据编号".equals(ve.getDisplayName())) {
			erpNumber = ve.getValue();
		}
	}

	@Override
	protected boolean save() {
		return LingLiaoDao.save(erpNumber, flowStatus);
	}

}
